package com.sskj.qiangjin.ui;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.sskj.qiangjin.R;
import com.sskj.qiangjin.bean.NewNoticeBean;

public class NoticeDialog extends Dialog {
    private TextView tv_content;
    private TextView tv_check;
    private toCheck toCheck;
    private NewNoticeBean.PopupBean popupBean;

    public void setToCheck(NoticeDialog.toCheck toCheck) {
        this.toCheck = toCheck;
    }

    public NoticeDialog(@NonNull Context context, NewNoticeBean.PopupBean popupBean) {
        super(context);
        this.popupBean = popupBean;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.app_notice_dialog);
        tv_content = findViewById(R.id.tv_content);
        tv_check = findViewById(R.id.tv_check);
        tv_content.setText(popupBean.getContent());
        tv_check.setOnClickListener(view -> toCheck.check(popupBean.getId()));
    }

    public interface toCheck {
        void check(String id);
    }
}
